package com.ruoyi.system.domain;

import java.math.BigDecimal;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.data.annotation.Transient;

/**
 * 单据对象 tbl_order
 *
 * @author 协同
 * @date 2022-04-18
 */
public class Order extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    private Long id;

    /**
     * 单据编号
     */
    private String orderNumber;

    /**
     * 上游单据编号
     */
    private String parentOrderNumber;

    /**
     * 单据类型(1采购申请单 2询价单 3报价单 4采购订单 5收料通知单 6采购入库单 7退料通知单 8采购退料单)
     */
    private String type;

    /**
     * 单据状态(0未审核 1已审核)
     */
    private String status;

    /**
     * 企业用户id
     */
    private Long eid;

    /**
     * 单据时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date orderTime;

    /**
     * 物料编码
     */
    private String code;

    /**
     * 物料名称
     */
    private String name;

    /**
     * 数量
     */
    private Integer num;

    /**
     * 退料数量
     */
    private Integer returnNum;

    public Integer getReturnNum() {
        return returnNum;
    }

    public void setReturnNum(Integer returnNum) {
        this.returnNum = returnNum;
    }

    /**
     * 单价
     */
    private BigDecimal price;

    /**
     * 供应商用户id
     */
    private Long sid;

    private String enterpriseName;

    private String supplierName;

    @Transient
    private String supplierNames;

    public String getSupplierNames() {
        return supplierNames;
    }

    public void setSupplierNames(String supplierNames) {
        this.supplierNames = supplierNames;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public String getEnterpriseName() {
        return enterpriseName;
    }

    public void setEnterpriseName(String enterpriseName) {
        this.enterpriseName = enterpriseName;
    }

    @Transient
    private String typeStr;

    public void setTypeStr(String typeStr) {
        this.typeStr = typeStr;
    }

    public String getTypeStr() {
        if (type != null) {
            switch (type) {
                case "1":
                    typeStr = "采购申请单";
                    break;
                case "2":
                    typeStr = "询价单";
                    break;
                case "3":
                    typeStr = "报价单";
                    break;
                case "4":
                    typeStr = "采购订单";
                    break;
                case "5":
                    typeStr = "收料通知单";
                    break;
                case "6":
                    typeStr = "采购入库单";
                    break;
                case "7":
                    typeStr = "退料通知单";
                    break;
                case "8":
                    typeStr = "采购退料单";
                    break;
                default:
                    typeStr = "";
                    break;
            }
        }
        return typeStr;
    }

    private String isPush;

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date expectedTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date commitmentTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date returnTime;

    public Date getExpectedTime() {
        return expectedTime;
    }

    public void setExpectedTime(Date expectedTime) {
        this.expectedTime = expectedTime;
    }

    public Date getCommitmentTime() {
        return commitmentTime;
    }

    public void setCommitmentTime(Date commitmentTime) {
        this.commitmentTime = commitmentTime;
    }

    public Date getReturnTime() {
        return returnTime;
    }

    public void setReturnTime(Date returnTime) {
        this.returnTime = returnTime;
    }

    public String getIsPush() {
        return isPush;
    }

    public void setIsPush(String isPush) {
        this.isPush = isPush;
    }

    @Transient
    private Integer isQuote = 0;

    public Integer getIsQuote() {
        return isQuote;
    }

    public void setIsQuote(Integer isQuote) {
        this.isQuote = isQuote;
    }

    @Transient
    private Long materialId;

    public Long getMaterialId() {
        return materialId;
    }

    public void setMaterialId(Long materialId) {
        this.materialId = materialId;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getOrderNumber() {
        return orderNumber;
    }

    public void setParentOrderNumber(String parentOrderNumber) {
        this.parentOrderNumber = parentOrderNumber;
    }

    public String getParentOrderNumber() {
        return parentOrderNumber;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getStatus() {
        return status;
    }

    public void setEid(Long eid) {
        this.eid = eid;
    }

    public Long getEid() {
        return eid;
    }

    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    public Date getOrderTime() {
        return orderTime;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public Integer getNum() {
        return num;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setSid(Long sid) {
        this.sid = sid;
    }

    public Long getSid() {
        return sid;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("orderNumber", getOrderNumber())
                .append("parentOrderNumber", getParentOrderNumber())
                .append("type", getType())
                .append("status", getStatus())
                .append("eid", getEid())
                .append("orderTime", getOrderTime())
                .append("code", getCode())
                .append("name", getName())
                .append("num", getNum())
                .append("returnNum", getReturnNum())
                .append("price", getPrice())
                .append("sid", getSid())
                .append("isPush", getIsPush())
                .append("expectedTime", getExpectedTime())
                .append("commitmentTime", getCommitmentTime())
                .append("returnTime", getReturnTime())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
